Skip to content

feat(messaging): add messaging bridge pattern#377

Merged
JerrettDavis merged 1 commit into
mainfrom
feature/messaging-bridge-pattern
May 27, 2026
Merged

feat(messaging): add messaging bridge pattern#377
JerrettDavis merged 1 commit into
mainfrom
feature/messaging-bridge-pattern

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

Summary

  • closes Add Messaging Bridge enterprise integration pattern #372 by adding the Messaging Bridge pattern for channel-to-bus topology boundaries
  • adds fluent runtime API plus [GenerateMessagingBridge] source-generated factory path and diagnostics
  • adds a DI-importable partner order bridge example, docs, catalogs, TinyBDD coverage, and BenchmarkDotNet measurements

Validation

  • dotnet build PatternKit.slnx --configuration Release --no-restore -m:1
  • dotnet test test\PatternKit.Tests\PatternKit.Tests.csproj --configuration Release --no-build --logger "console;verbosity=minimal" -p:TestTfmsInParallel=false
  • dotnet test test\PatternKit.Generators.Tests\PatternKit.Generators.Tests.csproj --configuration Release --no-build --logger "console;verbosity=minimal" -p:TestTfmsInParallel=false
  • dotnet test test\PatternKit.Examples.Tests\PatternKit.Examples.Tests.csproj --configuration Release --no-build --logger "console;verbosity=minimal" -p:TestTfmsInParallel=false
  • dotnet run -c Release --framework net10.0 --project benchmarks\PatternKit.Benchmarks -- --filter MessagingBridge --artifacts artifacts\benchmarks-messagingbridge --join

Benchmarks

  • Construction: fluent 184.0 ns / 1,328 B; generated 185.5 ns / 1,328 B
  • Execution: fluent 666.8 ns / 3,912 B; generated 670.8 ns / 3,912 B

Note: dotnet test PatternKit.slnx --configuration Release --no-build hit a runner timeout locally with stuck testhost processes, so the three test projects were rerun separately and passed.

Copilot AI review requested due to automatic review settings May 27, 2026 02:58
@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Messaging Bridge enterprise integration slice that bridges a MessageChannel<TInbound> into a MessageBus<TOutbound> with explicit translation + topic selection, alongside a source generator for bridge builder factories, plus docs/examples/tests/benchmarks and catalog updates to include the new pattern.

Changes:

  • Introduces MessagingBridge<TInbound,TOutbound> runtime API and MessagingBridgeGenerator ([GenerateMessagingBridge]) with diagnostics.
  • Adds Partner Order bridge example (including DI registration), TinyBDD test coverage, and BenchmarkDotNet benchmarks for fluent vs generated parity.
  • Updates pattern/generator/example docs, catalogs, README and benchmark coverage matrices to include “Messaging Bridge”.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/PatternKit.Tests/Messaging/Bridges/MessagingBridgeTests.cs Adds TinyBDD coverage for fluent bridge behavior (BridgeNext/BridgeAll + validation).
test/PatternKit.Generators.Tests/MessagingBridgeGeneratorTests.cs Verifies generated factory output and generator diagnostics IDs.
test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs Adds attribute coverage for GenerateMessagingBridgeAttribute.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs Updates catalog tests to include the new pattern and count.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitBenchmarkCoverageTests.cs Updates expected benchmark route-result totals to include the new pattern.
test/PatternKit.Examples.Tests/Messaging/PartnerOrderMessagingBridgeExampleTests.cs Validates fluent/generated/DI-imported partner order bridge example.
src/PatternKit.Generators/Messaging/MessagingBridgeGenerator.cs Adds incremental generator emitting a typed bridge builder factory + diagnostics.
src/PatternKit.Generators/AnalyzerReleases.Unshipped.md Registers new diagnostic IDs PKMBR001/PKMBR002.
src/PatternKit.Generators.Abstractions/Messaging/MessagingBridgeAttributes.cs Adds [GenerateMessagingBridge] attribute definition.
src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Registers “Messaging Bridge” in the pattern catalog with docs/tests/example links.
src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs Adds “Partner Order Messaging Bridge” example descriptor.
src/PatternKit.Examples/Messaging/PartnerOrderMessagingBridgeExample.cs Implements fluent + generated bridge example, runner, DI wiring, and summary type.
src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs Adds aggregate example registration for the messaging bridge demo.
src/PatternKit.Core/Messaging/Bridges/MessagingBridge.cs Introduces the core MessagingBridge API + result type.
README.md Updates pattern counts and benchmark table to include Messaging Bridge.
docs/patterns/toc.yml Adds Messaging Bridge entry to the docs TOC (and Message Bus placement).
docs/patterns/messaging/messaging-bridge.md Adds pattern documentation and fluent usage sample.
docs/guides/pattern-coverage.md Adds Messaging Bridge row to the coverage guide table.
docs/guides/benchmarks.md Adds Messaging Bridge benchmark rows.
docs/guides/benchmark-results.md Adds Messaging Bridge benchmark rows + updates coverage matrix totals.
docs/generators/toc.yml Adds Messaging Bridge generator doc to generators TOC.
docs/generators/messaging-bridge.md Documents generator usage + diagnostics.
docs/generators/index.md Adds generator overview entry for Messaging Bridge.
docs/examples/toc.yml Adds Partner Order Messaging Bridge example entry.
docs/examples/partner-order-messaging-bridge.md Adds example write-up and pointers to implementation/tests.
benchmarks/PatternKit.Benchmarks/Messaging/MessagingBridgeBenchmarks.cs Adds construction/execution benchmarks for fluent vs generated bridge.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +13
using PatternKit.Messaging.Channels;

namespace PatternKit.Messaging.Bridges;

/// <summary>
/// Bridges messages from one channel topology into another bus while keeping translation explicit.
/// </summary>
public sealed class MessagingBridge<TInbound, TOutbound>
{
private readonly MessageChannel<TInbound> _source;
private readonly MessageBus<TOutbound> _target;
private readonly Func<Message<TInbound>, Message<TOutbound>> _translator;
private readonly Func<Message<TInbound>, string> _topicSelector;
Comment on lines +33 to +36
var first = channels.CommerceEvents.TryReceive();
var correlationId = first.Message?.Headers.CorrelationId;
if (first.Received && first.Message is not null)
channels.CommerceEvents.Send(first.Message);
@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Test Results

827 tests   827 ✅  33s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit a77126b.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

🔍 PR Validation Results

Version: ``

✅ Validation Steps

  • Build solution
  • Run tests
  • Build documentation
  • Dry-run NuGet packaging

📊 Artifacts

Dry-run artifacts have been uploaded and will be available for 7 days.


This comment was automatically generated by the PR validation workflow.

@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.62550% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.60%. Comparing base (dea38a6) to head (a77126b).

Files with missing lines Patch % Lines
...t.Generators/Messaging/MessagingBridgeGenerator.cs 88.31% 9 Missing ⚠️
...tternKit.Core/Messaging/Bridges/MessagingBridge.cs 90.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #377      +/-   ##
==========================================
+ Coverage   89.60%   95.60%   +5.99%     
==========================================
  Files         506      510       +4     
  Lines       41377    41628     +251     
  Branches     5972     6011      +39     
==========================================
+ Hits        37075    39797    +2722     
+ Misses       1959     1831     -128     
+ Partials     2343        0    -2343     
Flag Coverage Δ
unittests 95.60% <93.62%> (+5.99%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JerrettDavis
JerrettDavis force-pushed the feature/messaging-bridge-pattern branch from fae0771 to a77126b Compare May 27, 2026 03:09
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/27/2026 - 03:14:37
  Coverage date: 05/27/2026 - 03:12:46 - 05/27/2026 - 03:14:26
  Parser: MultiReport (9x Cobertura)
  Assemblies: 4
  Classes: 1550
  Files: 623
  Line coverage: 94.5%
  Covered lines: 40806
  Uncovered lines: 2344
  Coverable lines: 43150
  Total lines: 94481
  Branch coverage: 75.5% (12010 of 15903)
  Covered branches: 12010
  Total branches: 15903
  Method coverage: 95.9% (8168 of 8512)
  Full method coverage: 88.1% (7501 of 8512)
  Covered methods: 8168
  Fully covered methods: 7501
  Total methods: 8512

PatternKit.Core                                                                                                     95.4%
  PatternKit.Application.ActivityTracking.ActivityGateState                                                          100%
  PatternKit.Application.ActivityTracking.ActivityLease                                                              100%
  PatternKit.Application.ActivityTracking.ActivityRecord                                                             100%
  PatternKit.Application.ActivityTracking.ActivityTracker                                                            100%
  PatternKit.Application.AntiCorruption.AntiCorruptionLayer<T1, T2>                                                 90.4%
  PatternKit.Application.AntiCorruption.AntiCorruptionResult<T>                                                      100%
  PatternKit.Application.AuditLog.AuditLogAppendResult<T>                                                           85.7%
  PatternKit.Application.AuditLog.InMemoryAuditLog<T1, T2>                                                          95.4%
  PatternKit.Application.DataMapping.DataMapper<T1, T2>                                                             94.6%
  PatternKit.Application.DataMapping.DataMapperError                                                                  90%
  PatternKit.Application.DataMapping.DataMapperResult<T>                                                            84.6%
  PatternKit.Application.DomainEvents.DomainEventDispatcher<T>                                                      95.4%
  PatternKit.Application.DomainEvents.DomainEventDispatchResult                                                      100%
  PatternKit.Application.EventSourcing.EventStoreAppendResult                                                        100%
  PatternKit.Application.EventSourcing.InMemoryEventStore<T1, T2>                                                   97.9%
  PatternKit.Application.EventSourcing.StoredEvent<T1, T2>                                                            80%
  PatternKit.Application.FeatureToggles.FeatureToggleDecision                                                       87.5%
  PatternKit.Application.FeatureToggles.FeatureToggleRule<T>                                                         100%
  PatternKit.Application.FeatureToggles.FeatureToggleSet<T>                                                         96.9%
  PatternKit.Application.IdentityMap.IdentityMap<T1, T2>                                                             100%
  PatternKit.Application.IdentityMap.IdentityMapResult<T>                                                           92.8%
  PatternKit.Application.MaterializedViews.MaterializedView<T1, T2>                                                 98.4%
  PatternKit.Application.Repository.InMemoryRepository<T1, T2>                                                      92.8%
  PatternKit.Application.Repository.RepositoryResult<T>                                                             93.3%
  PatternKit.Application.ServiceLayer.ServiceLayerOperation<T1, T2>                                                 96.7%
  PatternKit.Application.ServiceLayer.ServiceLayerResult<T>                                                         94.7%
  PatternKit.Application.ServiceLayer.ServiceLayerRule<T>                                                            100%
  PatternKit.Application.Specification.Specification<T>                                                              100%
  PatternKit.Application.Specification.SpecificationRegistry<T>                                                     93.3%
  PatternKit.Application.TableDataGateway.InMemoryTableDataGateway<T1, T2>                                            86%
  PatternKit.Application.TableDataGateway.TableGatewayResult<T>                                                     82.3%
  PatternKit.Application.TransactionScript.TransactionScript<T1, T2>                                                  97%
  PatternKit.Application.TransactionScript.TransactionScriptError                                                     90%
  PatternKit.Application.TransactionScript.TransactionScriptResult<T>                                                100%
  PatternKit.Application.UnitOfWork.UnitOfWork                                                                      90.9%
  PatternKit.Application.UnitOfWork.UnitOfWorkResult                                                                94.7%
  PatternKit.Application.UnitOfWork.UnitOfWorkRollbackResult                                                         100%
  PatternKit.Application.UnitOfWork.UnitOfWorkStep                                                                   100%

@JerrettDavis
JerrettDavis merged commit fa96e10 into main May 27, 2026
13 checks passed
@JerrettDavis
JerrettDavis deleted the feature/messaging-bridge-pattern branch May 27, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Messaging Bridge enterprise integration pattern

2 participants